package cn.yang.domain.award.model.aggregate;

import cn.yang.domain.award.model.entity.UserAwardRecordEntity;
import cn.yang.domain.award.model.entity.UserCreditAwardEntity;
import cn.yang.domain.award.model.valobj.AwardStateVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @version v1.0
 * @ClassName: cn.yang.domain.award.model.aggregate
 * @Description: TODO
 * @Author: YJ
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GiveOutPricesAggregate {
    /**
     * 用户ID
     */
    private String userId;
    /**
     * 用户发奖记录
     */
    private UserAwardRecordEntity userAwardRecordEntity;
    /**
     * 用户积分奖品
     */
    private UserCreditAwardEntity userCreditAwardEntity;

    public static UserAwardRecordEntity buildDistributeAwardRecordEntity(String userId, String orderId, Integer awardId, AwardStateVO awardState) {
        return UserAwardRecordEntity.builder()
                .userId(userId)
                .orderId(orderId)
                .awardId(awardId)
                .awardState(awardState)
                .build();
    }

    public static UserCreditAwardEntity buildUserCreditAwardEntity(String userId, BigDecimal creditAmount) {
        return UserCreditAwardEntity.builder()
                .userId(userId)
                .creditAmount(creditAmount)
                .build();
    }
}
